﻿Imports Microsoft.WindowsAPICodePack.Shell
Imports Microsoft.WindowsAPICodePack.Controls

Public Class ApiExplorer

#Region "Drop Shadow From Window"
    Private Const CS_DROPSHADOW As Integer = 131072

    Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams

        Get
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ClassStyle = cp.ClassStyle Or CS_DROPSHADOW
            Return cp
        End Get

    End Property
#End Region

    Private MP As Point

    Private Sub WINDOW_TOP_BAR_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles WINDOW_TOP_BAR.MouseMove
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Me.Location = e.Location - MP + Me.Location
        End If
    End Sub

    Private Sub WINDOW_TOP_BAR_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles WINDOW_TOP_BAR.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            MP = e.Location
        End If
    End Sub

    Private Sub ApiExplorer_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        EXIT_BOX.Parent = WINDOW_TOP_BAR              ' Set Parents
        FowardIco.Parent = WINDOW_TOP_BAR
        BackwardsIco.Parent = WINDOW_TOP_BAR

        Explorer.Navigate(ShellFileSystemFolder.FromFolderPath(My.Computer.FileSystem.SpecialDirectories.Desktop))  ' Navigate to Desktop
        PathBox.Text = My.Computer.FileSystem.SpecialDirectories.Desktop
    End Sub

    Private Sub EXIT_BOX_Click(sender As System.Object, e As System.EventArgs) Handles EXIT_BOX.Click
        Me.Close()
    End Sub

    Private Sub Explorer_NavigationComplete(sender As Object, e As Microsoft.WindowsAPICodePack.Controls.NavigationCompleteEventArgs) Handles Explorer.NavigationComplete
        PathBox.Text = Explorer.NavigationLog.CurrentLocation.ParsingName ' Show the new navigated path in PathBox
    End Sub

End Class